<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0;" name="viewport" />
<title>停车一道通</title>
<link type="text/css" rel="stylesheet" href="../../resource/weixin/css/login.css">
<script  type="text/javascript" src="../../resource/js/zepto.min.js"></script>
 <link rel="stylesheet" href="../../resource/frozen/css/frozen.css">
 <script src="../../resource/js/md5.js"></script>
 <script src="../../resource/frozen/js/frozen.js"></script>
 <script src="../../resource/js/result.js"></script>
 <script src="../../resource/js/phoneTip.js"></script>
</head>
<body>

<form action=""  method="post" id="form1">
<input type="hidden" name="type" value="4">
<div id="Content">
<div class="logo"> </div>
<!-- 用户名：<input type="text" name="username">
密码：<input type="password" name="password">

<input type="submit" value="提交"> -->
	<div class="form_box">
    	<div class="input_box" id="mobile_box">
        	<div class="left"><span class="username"></span></div>
            <div class="right"><input type="text" value="" name="username" id="username" placeholder="请输入手机号码"></div>
            <div class="c"></div>
        </div>
        
        <!--------密码---------->          
        <div class="input_box" id="password_box">
        	<div class="left"><span class="password"></span></div>
            <div class="right"><input type="password" value="" placeholder="请输入密码" id="password" name="password"></div>
            <div class="c"></div>        
        </div>
       
        <div class="input_box button_box"><input type="button" value="登录" id="Submit"></div>
        	<div class="foot_er"><a href="reg.html">注册账号</a>|<a href="forgot.html">忘记密码</a></div> 
    </div>
</div>
</form>
<script type="text/javascript">
// var info="${info }";
// if(info=="error"){
// 	$.tips({
//         content:'用户名或密码错误',
//         stayTime:1000,
//         type:"warn"
//     }) 
// }

function onBridgeReady() {
	WeixinJSBridge.call('hideOptionMenu');
}
if (typeof WeixinJSBridge == "undefined") {
	if (document.addEventListener) {
		document.addEventListener('WeixinJSBridgeReady', onBridgeReady,
				false);
	} else if (document.attachEvent) {
		document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
		document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
	}
} else {
	onBridgeReady();
}


$("#Submit").click(function(){
	var username=$("#username").val();
	var password=$("#password").val();
	if(username==""){
		frozen_warn("用户名不能为空！")
	    return false;
	}
	if(password==""){
		frozen_warn("密码不能为空！")
	    return false;
	}
	var remember="";
	
	if (typeof WeixinJSBridge == "undefined"){
		remember="1";
	}
	$.ajax({
		type:"POST",
		url:linkPre+'/ydtu/login.htm',
		data : {"username":$("#username").val(),"password":hex_md5($("#password").val()),"remember":remember},
		dataType : 'json',
		async:false,
		success : function(data) {
			checkResult_weixin(data.result);
			if(data.result== SUCCESS){
				if (typeof WeixinJSBridge != "undefined"){
					openid();	
				}
				else{
					if (typeof WeixinJSBridge != "undefined"){
						location.href = "infomation.html";
					}
					else{
						location.href = "index.html";
					}
				}
			}else{
				frozen_warn("账号或密码错误！")
			}
		}					
	});
})
function openid(){
			$.ajax({
				type : "POST",
				url:linkPre+ '/ydtu/tmember/openid.htm',
				data : {},
				dataType : 'json',
				success : function(data) {
					checkResult_weixin(data.result);
					if (data.result == SUCCESS) {
						location.href = "infomation.html";
					}
					else{
						closeWindow();
					}
				}
			})
			
		}

</script>
</body>
</html>